/*
 * To change this template, ch

@Override
public boolean verify(JComponent input) {
throw new UnsupportedOperationException("Not supported yet.");
}
}ose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Einheiteneditor.java
 *
 * Created on 01.04.2012, 11:52:33
 */
package Editoren;

import Einheiten.Attribute.Bewegung;
import Einheiten.Attribute.Audio;
import Einheiten.Attribute.EditorAttribut;
import Einheiten.Attribute.Grafik;
import Einheiten.Attribute.Kampf;
import Einheiten.Attribute.Technologie;
import Einheiten.Attribute.Text;
import Einheiten.Attribute.Typen.*;
import Einheiten.Attribute.Volk;
import Einheiten.Attribute.Werte;
import Einheiten.Einheit;
import Schnittstellen.Audio.Sound;
import Schnittstellen.Audio.Soundset;
import Schnittstellen.Graphisches.Modelle.Modell;
import Schnittstellen.Graphisches.Texturen.BildTextur;
import Schnittstellen.Graphisches.Texturen.Textur;
import Schnittstellen.ObjectManager;
import java.awt.Component;
import java.awt.event.ItemEvent;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.text.JTextComponent;

/**
 *
 * @author Geez
 */
public class Einheiteneditor extends javax.swing.JPanel {

    /** Creates new form Einheiteneditor */
    public Einheiteneditor() {
        initComponents();
        //enableAll(jTabbedPane1, false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel6 = new javax.swing.JPanel();
        jLabel50 = new javax.swing.JLabel();
        Tname = new javax.swing.JTextField();
        jLabel51 = new javax.swing.JLabel();
        TeditorSuffix = new javax.swing.JTextField();
        jLabel52 = new javax.swing.JLabel();
        jLabel53 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        Ptooltip = new javax.swing.JTextPane();
        Tshortkey = new javax.swing.JTextField();
        icon = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        Limagelist = new javax.swing.JList();
        jLabel67 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        TmaxTempo = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        TminTempo = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        CBbewegungstyp = new javax.swing.JComboBox(Bewegungstyp.values());
        Tbasistempo = new javax.swing.JTextField();
        Thoehe = new javax.swing.JTextField();
        Tdrehrate = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        CBbauloop = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        CBsoundset = new javax.swing.JComboBox();
        jPanel3 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        Tgehtempo = new javax.swing.JTextField();
        Trenntempo = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        Tueberblendzeit = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        Tauswahlskalierung = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        Tskalierung = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        CBbodentextur = new javax.swing.JComboBox();
        ChBwasserschatten = new javax.swing.JCheckBox();
        jLabel15 = new javax.swing.JLabel();
        TgeschosseinschlagZ = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        TgeschossstartX = new javax.swing.JTextField();
        TgeschossstartY = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        TgeschossstartZ = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        Tfahrtwinkel = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        Tschwenkwinkel = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        CBmodelldatei = new javax.swing.JComboBox();
        jLabel23 = new javax.swing.JLabel();
        CBschattentextur = new javax.swing.JComboBox();
        jLabel24 = new javax.swing.JLabel();
        TschattenbildHoehe = new javax.swing.JTextField();
        TschattenbildBreite = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        Tauswahlhoehe = new javax.swing.JTextField();
        ChBteamfarbe = new javax.swing.JCheckBox();
        ChBgeschossskalierung = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        Tabklingzeit = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        Tbasisschaden = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        Twuerfelseiten = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        Twuerfelzahl = new javax.swing.JTextField();
        jLabel30 = new javax.swing.JLabel();
        Twirkungsbereich = new javax.swing.JTextField();
        jLabel31 = new javax.swing.JLabel();
        Tstreuradius = new javax.swing.JTextField();
        jLabel32 = new javax.swing.JLabel();
        Tverlustfaktor = new javax.swing.JTextField();
        jLabel33 = new javax.swing.JLabel();
        Tgeschossbogen = new javax.swing.JTextField();
        jLabel34 = new javax.swing.JLabel();
        Tgeschosstempo = new javax.swing.JTextField();
        jLabel35 = new javax.swing.JLabel();
        Treichweite = new javax.swing.JTextField();
        jLabel36 = new javax.swing.JLabel();
        Tmindestreichweite = new javax.swing.JTextField();
        jLabel37 = new javax.swing.JLabel();
        Tbewegungspuffer = new javax.swing.JTextField();
        jLabel38 = new javax.swing.JLabel();
        Tzielerfassung = new javax.swing.JTextField();
        jLabel39 = new javax.swing.JLabel();
        TgleichzeitigeZiele = new javax.swing.JTextField();
        jLabel40 = new javax.swing.JLabel();
        CBangriffstyp = new javax.swing.JComboBox();
        CBgeschossgrafik = new javax.swing.JComboBox();
        jLabel41 = new javax.swing.JLabel();
        jLabel42 = new javax.swing.JLabel();
        CBzielgrafik = new javax.swing.JComboBox();
        jLabel43 = new javax.swing.JLabel();
        CBwaffensound = new javax.swing.JComboBox();
        jLabel44 = new javax.swing.JLabel();
        jLabel45 = new javax.swing.JLabel();
        CBwaffentyp = new javax.swing.JComboBox();
        jLabel46 = new javax.swing.JLabel();
        jLabel47 = new javax.swing.JLabel();
        CBverteidigungstyp = new javax.swing.JComboBox();
        ChBzielsuchendesgeschoss = new javax.swing.JCheckBox();
        Tzugelasseneziele = new javax.swing.JTextField();
        Tzielwirkungsbereich = new javax.swing.JTextField();
        jLabel65 = new javax.swing.JLabel();
        tbasisverteidigung = new javax.swing.JTextField();
        jLabel66 = new javax.swing.JLabel();
        Tzieltyp = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jLabel48 = new javax.swing.JLabel();
        jLabel49 = new javax.swing.JLabel();
        Tvorrausgesetzeeinheiten = new javax.swing.JTextField();
        Tverkaufteeinheiten = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        jLabel54 = new javax.swing.JLabel();
        Tkollisionsgroesse = new javax.swing.JTextField();
        Tbauzeit = new javax.swing.JTextField();
        jLabel55 = new javax.swing.JLabel();
        Tessenskosten = new javax.swing.JTextField();
        jLabel56 = new javax.swing.JLabel();
        jLabel57 = new javax.swing.JLabel();
        Trohstoffkosten = new javax.swing.JTextField();
        jLabel58 = new javax.swing.JLabel();
        Ttrefferpunkte = new javax.swing.JTextField();
        jLabel59 = new javax.swing.JLabel();
        Tregeneration = new javax.swing.JTextField();
        jLabel60 = new javax.swing.JLabel();
        Tproduziertesessen = new javax.swing.JTextField();
        jLabel61 = new javax.swing.JLabel();
        Tsichtradius = new javax.swing.JTextField();
        jLabel62 = new javax.swing.JLabel();
        Ttransportgroesse = new javax.swing.JTextField();
        jLabel63 = new javax.swing.JLabel();
        jLabel64 = new javax.swing.JLabel();
        CBregenerationstyp = new javax.swing.JComboBox();
        CBvolk = new javax.swing.JComboBox();
        Bneu = new javax.swing.JButton();
        Bspeichern = new javax.swing.JButton();
        CBeinheitenliste = new javax.swing.JComboBox();
        Bladen = new javax.swing.JButton();

        jPanel6.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel50.setText("Name:");
        jPanel6.add(jLabel50, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 14, -1, -1));

        Tname.setText("neuerName");
        jPanel6.add(Tname, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 10, 180, -1));

        jLabel51.setText("EditorSuffix:");
        jPanel6.add(jLabel51, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        TeditorSuffix.setText("[ ]");
        jPanel6.add(TeditorSuffix, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 40, 180, -1));

        jLabel52.setText("Shortkey:");
        jPanel6.add(jLabel52, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, -1, -1));

        jLabel53.setText("Tooltip:");
        jPanel6.add(jLabel53, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, -1, -1));

        jScrollPane1.setViewportView(Ptooltip);

        jPanel6.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 110, 210, 110));
        jPanel6.add(Tshortkey, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 70, 180, -1));

        icon.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel6.add(icon, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 70, 64, 64));

        Limagelist.setModel(new javax.swing.AbstractListModel() {

            public int getSize() { return om.getTexturbank().size(); }
            public Object getElementAt(int i) { return om.getTexturbank().get(i); }
        });
        Limagelist.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                LimagelistValueChanged(evt);
            }
        });
        jScrollPane2.setViewportView(Limagelist);

        jPanel6.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 60, 100, 220));

        jLabel67.setText("Images");
        jPanel6.add(jLabel67, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 30, 100, -1));

        jTabbedPane1.addTab("Text", jPanel6);

        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setText("BaseSpeed:");
        jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 14, 90, -1));

        jLabel2.setText("Turn Rate:");
        jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 45, 90, -1));

        jLabel3.setText("Height:");
        jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 76, 90, -1));

        jLabel4.setText("Speed max.:");
        jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 10, 110, -1));

        TmaxTempo.setText("100");
        jPanel1.add(TmaxTempo, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 10, 40, -1));

        jLabel5.setText("Speed min.:");
        jPanel1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 40, 110, -1));

        TminTempo.setText("1");
        TminTempo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TminTempoActionPerformed(evt);
            }
        });
        jPanel1.add(TminTempo, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 40, 40, -1));

        jLabel6.setText("Typ:");
        jPanel1.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 80, 110, -1));

        CBbewegungstyp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CBbewegungstypActionPerformed(evt);
            }
        });
        jPanel1.add(CBbewegungstyp, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 80, 90, -1));

        Tbasistempo.setText("100");
        jPanel1.add(Tbasistempo, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 10, 40, -1));

        Thoehe.setText("1");
        Thoehe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ThoeheActionPerformed(evt);
            }
        });
        jPanel1.add(Thoehe, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 70, 40, -1));

        Tdrehrate.setText("1");
        Tdrehrate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TdrehrateActionPerformed(evt);
            }
        });
        jPanel1.add(Tdrehrate, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 40, 40, -1));

        jTabbedPane1.addTab("Movement", jPanel1);

        jPanel2.setLayout(null);

        jLabel7.setText("Loop during Construction:");
        jPanel2.add(jLabel7);
        jLabel7.setBounds(10, 20, 130, 14);

        CBbauloop.setModel(new DefaultComboBoxModel(om.getSoundbank()));
        jPanel2.add(CBbauloop);
        CBbauloop.setBounds(150, 20, 90, 20);

        jLabel8.setText("Unit-Soundset:");
        jPanel2.add(jLabel8);
        jLabel8.setBounds(10, 50, 130, 14);

        CBsoundset.setModel(new DefaultComboBoxModel(om.getSoundsetbank()));
        jPanel2.add(CBsoundset);
        CBsoundset.setBounds(150, 50, 90, 20);

        jTabbedPane1.addTab("Sound", jPanel2);

        jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel9.setText("Walkspeed:");
        jPanel3.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 14, 100, -1));

        Tgehtempo.setText("100");
        jPanel3.add(Tgehtempo, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 40, -1));

        Trenntempo.setText("100");
        jPanel3.add(Trenntempo, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 40, 40, -1));

        jLabel10.setText("Runspeed:");
        jPanel3.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, 100, -1));

        Tueberblendzeit.setText("0.1");
        jPanel3.add(Tueberblendzeit, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 70, 40, -1));

        jLabel11.setText("Blendtime:");
        jPanel3.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 100, -1));

        Tauswahlskalierung.setText("1");
        jPanel3.add(Tauswahlskalierung, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 100, 40, -1));

        jLabel12.setText("Selection Scale:");
        jPanel3.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, 100, -1));

        jLabel13.setText("Selection Height:");
        jPanel3.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 130, 100, -1));

        Tskalierung.setText("1");
        jPanel3.add(Tskalierung, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 250, 40, -1));

        jLabel14.setText("Floor Texture:");
        jPanel3.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 160, 100, -1));

        CBbodentextur.setModel(new DefaultComboBoxModel(om.getTexturbank()));
        jPanel3.add(CBbodentextur, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 160, 90, -1));

        ChBwasserschatten.setText("Watershadow");
        jPanel3.add(ChBwasserschatten, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 280, 140, -1));

        jLabel15.setText("Impact Z:");
        jPanel3.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 10, 120, -1));

        TgeschosseinschlagZ.setText("1");
        jPanel3.add(TgeschosseinschlagZ, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 10, 40, -1));

        jLabel16.setText("Missilestart X:");
        jPanel3.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 40, 120, -1));

        TgeschossstartX.setText("0");
        jPanel3.add(TgeschossstartX, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 40, 40, -1));

        TgeschossstartY.setText("0");
        jPanel3.add(TgeschossstartY, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 70, 40, -1));

        jLabel17.setText("Missilestart Y:");
        jPanel3.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 70, 120, -1));

        TgeschossstartZ.setText("1");
        jPanel3.add(TgeschossstartZ, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 100, 40, -1));

        jLabel18.setText("Missilestart Z:");
        jPanel3.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 100, 120, -1));

        Tfahrtwinkel.setText("45");
        jPanel3.add(Tfahrtwinkel, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 130, 40, -1));

        jLabel20.setText("Roll max.:");
        jPanel3.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 130, 120, -1));

        Tschwenkwinkel.setText("45");
        jPanel3.add(Tschwenkwinkel, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 160, 40, -1));

        jLabel21.setText("Pitch max.:");
        jPanel3.add(jLabel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 160, 120, -1));

        jLabel22.setText("Modelfile:");
        jPanel3.add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 190, 100, -1));

        CBmodelldatei.setModel(new DefaultComboBoxModel(om.getModellbank()));
        jPanel3.add(CBmodelldatei, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 190, 90, -1));

        jLabel23.setText("Shadow Texture");
        jPanel3.add(jLabel23, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 220, 100, -1));

        CBschattentextur.setModel(new DefaultComboBoxModel(om.getTexturbank()));
        jPanel3.add(CBschattentextur, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 220, 90, -1));

        jLabel24.setText("Shadow Height:");
        jPanel3.add(jLabel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 220, 120, -1));

        TschattenbildHoehe.setText("100");
        jPanel3.add(TschattenbildHoehe, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 220, 40, -1));

        TschattenbildBreite.setText("100");
        jPanel3.add(TschattenbildBreite, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 190, 40, -1));

        jLabel25.setText("Shadow Width:");
        jPanel3.add(jLabel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 190, 120, -1));

        jLabel26.setText("Model Scale:");
        jPanel3.add(jLabel26, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 250, 100, -1));

        Tauswahlhoehe.setText("1");
        jPanel3.add(Tauswahlhoehe, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 130, 40, -1));

        ChBteamfarbe.setText("Use Teamcolors:");
        jPanel3.add(ChBteamfarbe, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 280, 150, -1));

        ChBgeschossskalierung.setText("Missile Scale");
        ChBgeschossskalierung.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ChBgeschossskalierungActionPerformed(evt);
            }
        });
        jPanel3.add(ChBgeschossskalierung, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 250, 140, -1));

        jTabbedPane1.addTab("Graphics", jPanel3);

        jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel19.setText("Cooldown:");
        jPanel4.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 14, 100, -1));

        Tabklingzeit.setText("1");
        jPanel4.add(Tabklingzeit, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 10, 40, -1));

        jLabel27.setText("Base Damage:");
        jPanel4.add(jLabel27, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, 100, -1));

        Tbasisschaden.setText("0");
        jPanel4.add(Tbasisschaden, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 40, 40, -1));

        jLabel28.setText("Dice Edges:");
        jPanel4.add(jLabel28, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 100, -1));

        Twuerfelseiten.setText("0");
        jPanel4.add(Twuerfelseiten, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 70, 40, -1));

        jLabel29.setText("Dice Quantity:");
        jPanel4.add(jLabel29, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, 100, -1));

        Twuerfelzahl.setText("0");
        jPanel4.add(Twuerfelzahl, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 100, 40, -1));

        jLabel30.setText("Impact Range:");
        jPanel4.add(jLabel30, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 130, 100, -1));

        Twirkungsbereich.setText("0");
        jPanel4.add(Twirkungsbereich, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 130, 40, -1));

        jLabel31.setText("Scattering Range:");
        jPanel4.add(jLabel31, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 160, 100, -1));

        Tstreuradius.setText("0");
        jPanel4.add(Tstreuradius, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 160, 40, -1));

        jLabel32.setText("Damageloss:");
        jPanel4.add(jLabel32, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 190, 100, -1));

        Tverlustfaktor.setText("0");
        jPanel4.add(Tverlustfaktor, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 190, 40, -1));

        jLabel33.setText("Missile Arc:");
        jPanel4.add(jLabel33, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 220, 100, -1));

        Tgeschossbogen.setText("0");
        jPanel4.add(Tgeschossbogen, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 220, 40, -1));

        jLabel34.setText("Missile Speed:");
        jPanel4.add(jLabel34, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 250, 100, -1));

        Tgeschosstempo.setText("100");
        jPanel4.add(Tgeschosstempo, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 250, 40, -1));

        jLabel35.setText("Range max.:");
        jPanel4.add(jLabel35, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 280, 100, -1));

        Treichweite.setText("0");
        jPanel4.add(Treichweite, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 280, 40, -1));

        jLabel36.setText("Range min.:");
        jPanel4.add(jLabel36, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 310, 100, -1));

        Tmindestreichweite.setText("0");
        jPanel4.add(Tmindestreichweite, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 310, 40, -1));

        jLabel37.setText("Range Buffer:");
        jPanel4.add(jLabel37, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 340, 100, -1));

        Tbewegungspuffer.setText("0");
        jPanel4.add(Tbewegungspuffer, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 340, 40, -1));

        jLabel38.setText("Acquire Range:");
        jPanel4.add(jLabel38, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 20, 110, -1));

        Tzielerfassung.setText("100");
        jPanel4.add(Tzielerfassung, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 20, 40, -1));

        jLabel39.setText("Target max.:");
        jPanel4.add(jLabel39, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 50, 110, -1));

        TgleichzeitigeZiele.setText("1");
        jPanel4.add(TgleichzeitigeZiele, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 50, 40, -1));

        jLabel40.setText("Attack Typ:");
        jPanel4.add(jLabel40, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 80, 110, -1));

        CBangriffstyp.setModel(new javax.swing.DefaultComboBoxModel(Angriffstyp.values()));
        jPanel4.add(CBangriffstyp, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 80, 90, -1));

        CBgeschossgrafik.setModel(new DefaultComboBoxModel(om.getModellbank()));
        jPanel4.add(CBgeschossgrafik, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 110, 90, -1));

        jLabel41.setText("Missile Art:");
        jPanel4.add(jLabel41, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 110, 110, -1));

        jLabel42.setText("Target Art:");
        jPanel4.add(jLabel42, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 140, 110, -1));

        CBzielgrafik.setModel(new DefaultComboBoxModel(om.getModellbank()));
        jPanel4.add(CBzielgrafik, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 140, 90, -1));

        jLabel43.setText("Weapontype:");
        jPanel4.add(jLabel43, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 170, 110, -1));

        CBwaffensound.setModel(new DefaultComboBoxModel(om.getSoundbank()));
        jPanel4.add(CBwaffensound, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 170, 90, -1));

        jLabel44.setText("Weapontype:");
        jPanel4.add(jLabel44, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 200, 110, -1));

        jLabel45.setText("allowed Targets:");
        jPanel4.add(jLabel45, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 230, 120, -1));

        CBwaffentyp.setModel(new javax.swing.DefaultComboBoxModel(Waffentyp.values()));
        jPanel4.add(CBwaffentyp, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 200, 90, -1));

        jLabel46.setText("allowed Foes:");
        jPanel4.add(jLabel46, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 260, 110, -1));

        jLabel47.setText("Defense Type:");
        jPanel4.add(jLabel47, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 290, 110, -1));

        CBverteidigungstyp.setModel(new javax.swing.DefaultComboBoxModel(Verteidigungstyp.values()));
        jPanel4.add(CBverteidigungstyp, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 290, 90, -1));

        ChBzielsuchendesgeschoss.setText("Homing Missile");
        jPanel4.add(ChBzielsuchendesgeschoss, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 370, 170, -1));

        Tzugelasseneziele.setText("jTextField3");
        jPanel4.add(Tzugelasseneziele, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 260, 110, -1));

        Tzielwirkungsbereich.setText("jTextField3");
        Tzielwirkungsbereich.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TzielwirkungsbereichMouseClicked(evt);
            }
        });
        Tzielwirkungsbereich.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TzielwirkungsbereichActionPerformed(evt);
            }
        });
        jPanel4.add(Tzielwirkungsbereich, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 230, 110, -1));

        jLabel65.setText("Base Defense:");
        jPanel4.add(jLabel65, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 320, 100, -1));

        tbasisverteidigung.setText("0");
        jPanel4.add(tbasisverteidigung, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 320, 40, -1));

        jLabel66.setText("Target Type:");
        jPanel4.add(jLabel66, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 350, 100, -1));

        Tzieltyp.setText("0");
        jPanel4.add(Tzieltyp, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 350, 100, -1));

        jTabbedPane1.addTab("Combat", jPanel4);

        jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel48.setText("Required Units:");
        jPanel5.add(jLabel48, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 15, -1, -1));

        jLabel49.setText("Sell Units:");
        jPanel5.add(jLabel49, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, -1));

        Tvorrausgesetzeeinheiten.setText("jTextField3");
        jPanel5.add(Tvorrausgesetzeeinheiten, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 10, 130, -1));

        Tverkaufteeinheiten.setText("jTextField4");
        jPanel5.add(Tverkaufteeinheiten, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 50, 130, -1));

        jTabbedPane1.addTab("Tech", jPanel5);

        jPanel7.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel54.setText("Collision Size:");
        jPanel7.add(jLabel54, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 130, -1));

        Tkollisionsgroesse.setText("1");
        jPanel7.add(Tkollisionsgroesse, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 40, -1));

        Tbauzeit.setText("20");
        jPanel7.add(Tbauzeit, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 40, 40, -1));

        jLabel55.setText("Buildtime:");
        jPanel7.add(jLabel55, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, 130, -1));

        Tessenskosten.setText("1");
        jPanel7.add(Tessenskosten, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 70, 40, -1));

        jLabel56.setText("Food Costs:");
        jPanel7.add(jLabel56, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 130, -1));

        jLabel57.setText("Mineral Costs:");
        jPanel7.add(jLabel57, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, 130, -1));

        Trohstoffkosten.setText("100");
        jPanel7.add(Trohstoffkosten, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 100, 40, -1));

        jLabel58.setText("Base Hitpoints");
        jPanel7.add(jLabel58, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 130, 130, -1));

        Ttrefferpunkte.setText("100");
        jPanel7.add(Ttrefferpunkte, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 130, 40, -1));

        jLabel59.setText("Regeneration:");
        jPanel7.add(jLabel59, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 160, 130, -1));

        Tregeneration.setText("1.0");
        jPanel7.add(Tregeneration, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 160, 40, -1));

        jLabel60.setText("Produced Food:");
        jPanel7.add(jLabel60, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 10, 120, -1));

        Tproduziertesessen.setText("0");
        jPanel7.add(Tproduziertesessen, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 10, 40, -1));

        jLabel61.setText("Sight Range");
        jPanel7.add(jLabel61, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 40, 120, -1));

        Tsichtradius.setText("100");
        jPanel7.add(Tsichtradius, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 40, 40, -1));

        jLabel62.setText("Transport Size:");
        jPanel7.add(jLabel62, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 70, 120, -1));

        Ttransportgroesse.setText("1");
        jPanel7.add(Ttransportgroesse, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 70, 40, -1));

        jLabel63.setText("Regeneration Type:");
        jPanel7.add(jLabel63, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 100, 120, -1));

        jLabel64.setText("Race:");
        jPanel7.add(jLabel64, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 130, 120, -1));

        CBregenerationstyp.setModel(new javax.swing.DefaultComboBoxModel(Regenerationstyp.values()));
        jPanel7.add(CBregenerationstyp, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 100, 80, -1));

        CBvolk.setModel(new javax.swing.DefaultComboBoxModel(Volk.values()));
        jPanel7.add(CBvolk, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 130, 80, -1));

        jTabbedPane1.addTab("Values", jPanel7);

        Bneu.setText("Neu");
        Bneu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BneuActionPerformed(evt);
            }
        });

        Bspeichern.setText("Speichern");
        Bspeichern.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BspeichernActionPerformed(evt);
            }
        });

        CBeinheitenliste.setModel(new javax.swing.DefaultComboBoxModel(om.getEinheitenbank()));
        CBeinheitenliste.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                CBeinheitenlisteItemStateChanged(evt);
            }
        });

        Bladen.setText("Load");
        Bladen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BladenActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 553, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(Bneu)
                        .addGap(18, 18, 18)
                        .addComponent(Bspeichern)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 258, Short.MAX_VALUE)
                        .addComponent(Bladen)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(CBeinheitenliste, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Bneu)
                    .addComponent(Bspeichern)
                    .addComponent(CBeinheitenliste, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Bladen))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void ChBgeschossskalierungActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ChBgeschossskalierungActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ChBgeschossskalierungActionPerformed

    private void BneuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BneuActionPerformed
        reset(this);
        enableAll(this, true);
    }//GEN-LAST:event_BneuActionPerformed

    private void TzielwirkungsbereichMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TzielwirkungsbereichMouseClicked
    }//GEN-LAST:event_TzielwirkungsbereichMouseClicked

    private void TzielwirkungsbereichActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TzielwirkungsbereichActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TzielwirkungsbereichActionPerformed

    private void BspeichernActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BspeichernActionPerformed
        speicher();
    }//GEN-LAST:event_BspeichernActionPerformed

    private void CBbewegungstypActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CBbewegungstypActionPerformed

        System.out.println(CBbewegungstyp.getSelectedItem().toString());     }//GEN-LAST:event_CBbewegungstypActionPerformed

    private void TminTempoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TminTempoActionPerformed
        // TODO add your handling code here:}//GEN-LAST:event_TminTempoActionPerformed
    }
        private void ThoeheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ThoeheActionPerformed
            // TODO add your handling code here:
    }//GEN-LAST:event_ThoeheActionPerformed

    private void TdrehrateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TdrehrateActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TdrehrateActionPerformed

    private void CBeinheitenlisteItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_CBeinheitenlisteItemStateChanged
        if (evt.getStateChange() == ItemEvent.SELECTED) {
            Tname.setText(((Einheit) evt.getItem()).getEditorName());
        }
    }//GEN-LAST:event_CBeinheitenlisteItemStateChanged

    private void BladenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BladenActionPerformed
        lade((Einheit) CBeinheitenliste.getSelectedItem());
    }//GEN-LAST:event_BladenActionPerformed

private void LimagelistValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_LimagelistValueChanged
    icon.setIcon(new ImageIcon(((BildTextur)Limagelist.getSelectedValue()).getBufferedImage().getScaledInstance(64, 64, 1)));
}//GEN-LAST:event_LimagelistValueChanged

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Bladen;
    private javax.swing.JButton Bneu;
    private javax.swing.JButton Bspeichern;
    private javax.swing.JComboBox CBangriffstyp;
    private javax.swing.JComboBox CBbauloop;
    private javax.swing.JComboBox CBbewegungstyp;
    private javax.swing.JComboBox CBbodentextur;
    private javax.swing.JComboBox CBeinheitenliste;
    private javax.swing.JComboBox CBgeschossgrafik;
    private javax.swing.JComboBox CBmodelldatei;
    private javax.swing.JComboBox CBregenerationstyp;
    private javax.swing.JComboBox CBschattentextur;
    private javax.swing.JComboBox CBsoundset;
    private javax.swing.JComboBox CBverteidigungstyp;
    private javax.swing.JComboBox CBvolk;
    private javax.swing.JComboBox CBwaffensound;
    private javax.swing.JComboBox CBwaffentyp;
    private javax.swing.JComboBox CBzielgrafik;
    private javax.swing.JCheckBox ChBgeschossskalierung;
    private javax.swing.JCheckBox ChBteamfarbe;
    private javax.swing.JCheckBox ChBwasserschatten;
    private javax.swing.JCheckBox ChBzielsuchendesgeschoss;
    private javax.swing.JList Limagelist;
    private javax.swing.JTextPane Ptooltip;
    private javax.swing.JTextField Tabklingzeit;
    private javax.swing.JTextField Tauswahlhoehe;
    private javax.swing.JTextField Tauswahlskalierung;
    private javax.swing.JTextField Tbasisschaden;
    private javax.swing.JTextField Tbasistempo;
    private javax.swing.JTextField Tbauzeit;
    private javax.swing.JTextField Tbewegungspuffer;
    private javax.swing.JTextField Tdrehrate;
    private javax.swing.JTextField TeditorSuffix;
    private javax.swing.JTextField Tessenskosten;
    private javax.swing.JTextField Tfahrtwinkel;
    private javax.swing.JTextField Tgehtempo;
    private javax.swing.JTextField Tgeschossbogen;
    private javax.swing.JTextField TgeschosseinschlagZ;
    private javax.swing.JTextField TgeschossstartX;
    private javax.swing.JTextField TgeschossstartY;
    private javax.swing.JTextField TgeschossstartZ;
    private javax.swing.JTextField Tgeschosstempo;
    private javax.swing.JTextField TgleichzeitigeZiele;
    private javax.swing.JTextField Thoehe;
    private javax.swing.JTextField Tkollisionsgroesse;
    private javax.swing.JTextField TmaxTempo;
    private javax.swing.JTextField TminTempo;
    private javax.swing.JTextField Tmindestreichweite;
    private javax.swing.JTextField Tname;
    private javax.swing.JTextField Tproduziertesessen;
    private javax.swing.JTextField Tregeneration;
    private javax.swing.JTextField Treichweite;
    private javax.swing.JTextField Trenntempo;
    private javax.swing.JTextField Trohstoffkosten;
    private javax.swing.JTextField TschattenbildBreite;
    private javax.swing.JTextField TschattenbildHoehe;
    private javax.swing.JTextField Tschwenkwinkel;
    private javax.swing.JTextField Tshortkey;
    private javax.swing.JTextField Tsichtradius;
    private javax.swing.JTextField Tskalierung;
    private javax.swing.JTextField Tstreuradius;
    private javax.swing.JTextField Ttransportgroesse;
    private javax.swing.JTextField Ttrefferpunkte;
    private javax.swing.JTextField Tueberblendzeit;
    private javax.swing.JTextField Tverkaufteeinheiten;
    private javax.swing.JTextField Tverlustfaktor;
    private javax.swing.JTextField Tvorrausgesetzeeinheiten;
    private javax.swing.JTextField Twirkungsbereich;
    private javax.swing.JTextField Twuerfelseiten;
    private javax.swing.JTextField Twuerfelzahl;
    private javax.swing.JTextField Tzielerfassung;
    private javax.swing.JTextField Tzieltyp;
    private javax.swing.JTextField Tzielwirkungsbereich;
    private javax.swing.JTextField Tzugelasseneziele;
    private javax.swing.JLabel icon;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel46;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel48;
    private javax.swing.JLabel jLabel49;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel50;
    private javax.swing.JLabel jLabel51;
    private javax.swing.JLabel jLabel52;
    private javax.swing.JLabel jLabel53;
    private javax.swing.JLabel jLabel54;
    private javax.swing.JLabel jLabel55;
    private javax.swing.JLabel jLabel56;
    private javax.swing.JLabel jLabel57;
    private javax.swing.JLabel jLabel58;
    private javax.swing.JLabel jLabel59;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel60;
    private javax.swing.JLabel jLabel61;
    private javax.swing.JLabel jLabel62;
    private javax.swing.JLabel jLabel63;
    private javax.swing.JLabel jLabel64;
    private javax.swing.JLabel jLabel65;
    private javax.swing.JLabel jLabel66;
    private javax.swing.JLabel jLabel67;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField tbasisverteidigung;
    // End of variables declaration//GEN-END:variables
    private ObjectManager om = ObjectManager.getInstance();

    private void enableAll(JComponent parent, boolean value) {
        for (Component c : parent.getComponents()) {
            c.setEnabled(value);
            if (c instanceof JComponent) {
                enableAll((JComponent) c, value);
            }
        }
    }

    private void reset(JComponent parent) {
        for (Component c : parent.getComponents()) {
            if (c instanceof JTextComponent) {
                JTextComponent tc = ((JTextComponent) c);
                // tc.setText("");
            }
            if (c instanceof JComponent) {
                reset((JComponent) c);
            }
        }
    }

    /**
     * lädt die liste von CBeinheitenliste neu
     */
    public void reload() {
        CBeinheitenliste.updateUI();
    }

    private void speicher() {
        Einheit einheit = new Einheit();

        Text t = new Text();
        t.setEditorName(TeditorSuffix.getText());
        t.setName(Tname.getText());
        t.setShortkey(-1);
        t.setTooltip(Ptooltip.getText());

        Bewegung b = new Bewegung();
        b.setBasistempo(StrToInt(Tbasistempo.getText()));
        b.setDrehrate(StrToInt(Tdrehrate.getText()));
        b.setHoehe(StrToInt(Thoehe.getText()));
        b.setTempo_max(StrToInt(TmaxTempo.getText()));
        b.setTempo_min(StrToInt(TminTempo.getText()));
        b.setBewegungstyp((Bewegungstyp) CBbewegungstyp.getSelectedItem());

        Audio a = new Audio();
        a.setBauloop((Sound) CBbauloop.getSelectedItem());
        a.setEinheitenSoundset((Soundset) CBsoundset.getSelectedItem());

        Grafik g = new Grafik();
        g.setAnimationGehTempo(StrToInt(Tgehtempo.getText()));
        g.setAnimationRennTempo(StrToInt(Trenntempo.getText()));
        g.setAuswahlSkalierung(StrToDb(Tauswahlskalierung.getText()));
        g.setAuswahlkreisHoehe(StrToDb(Tauswahlhoehe.getText()));
        g.setBodentextur((Textur) CBbodentextur.getSelectedItem());
        g.setEigeneTeamfarbe(ChBteamfarbe.isSelected());
        g.setGeschossEinschlagZ(StrToInt(TgeschosseinschlagZ.getText()));
        g.setGeschossStartX(StrToInt(TgeschossstartX.getText()));
        g.setGeschossStartY(StrToInt(TgeschossstartY.getText()));
        g.setGeschossStartZ(StrToInt(TgeschossstartZ.getText()));
        g.setGeschosseSkalieren(ChBgeschossskalierung.isSelected());
        g.setMaxFahrtWinkel(StrToDb(Tfahrtwinkel.getText()));
        g.setMaxSchwenkWinkel(StrToDb(Tschwenkwinkel.getText()));
        g.setModell((Modell) CBmodelldatei.getSelectedItem());
        g.setSchattenbildBreite(StrToDb(TschattenbildBreite.getText()));
        g.setSchattenbildHoehe(StrToDb(TschattenbildHoehe.getText()));
        g.setSchattentextur((Textur) CBschattentextur.getSelectedItem());
        g.setSkalierung(StrToDb(Tskalierung.getText()));
        g.setUeberblendzeit(StrToDb(Tueberblendzeit.getText()));
        g.setWasserschatten(ChBwasserschatten.isSelected());

        Kampf k = new Kampf();
        k.setAbklingzeit(StrToInt(Tabklingzeit.getText()));
        k.setAngriffstyp((Angriffstyp) CBangriffstyp.getSelectedItem());
        k.setBasisSchaden(StrToInt(Tbasisschaden.getText()));
        k.setBasisVerteidigung(StrToInt(tbasisverteidigung.getText()));
        k.setGeschossBogen(StrToDb(Tgeschossbogen.getText()));
        k.setGeschossGrafik((Modell) CBgeschossgrafik.getSelectedItem());
        k.setGeschossTempo(StrToInt(Tgeschosstempo.getText()));
        k.setMaxAnzahlZiele(StrToInt(TgleichzeitigeZiele.getText()));
        k.setMinreichweite(StrToInt(Tmindestreichweite.getText()));
        k.setReichweite(StrToInt(Treichweite.getText()));
        k.setReichweitenBewegungsPuffer(StrToInt(Tbewegungspuffer.getText()));
        k.setSchadenStreuradius(StrToInt(Tstreuradius.getText()));
        k.setSchadenVerlustfaktor(StrToDb(Tverlustfaktor.getText()));
        k.setSchadenWirkungsbereich(StrToInt(Twirkungsbereich.getText()));
        k.setSchadenWuerfelAnzahl(StrToInt(Twuerfelzahl.getText()));
        k.setSchadenWuerfelSeiten(StrToInt(Twuerfelseiten.getText()));
        k.setVerteidigungstyp((Verteidigungstyp) CBverteidigungstyp.getSelectedItem());
        k.setWaffensound((Sound) CBwaffensound.getSelectedItem());
        k.setWaffentyp((Waffentyp) CBwaffentyp.getSelectedItem());
        k.setZielGrafik((Modell) CBzielgrafik.getSelectedItem());
        // TODO: k.setZielwirkungsbereich(zielwirkungsbereich);      
        k.setZielerfassungsReichweite(StrToInt(Tzielerfassung.getText()));
        k.setZielsuchendesGeschoss(ChBzielsuchendesgeschoss.isSelected());
        // TODO: k.setZugelasseneZiele(zugelasseneZiele);
        // TODO: k.setZieltyp(zieltyp);

        Technologie tech = new Technologie();
        // TODO: tech.setVerkaufteEinheiten(verkaufteEinheiten);
        // TODO: tech.setVorrausgesetzteEinheiten(vorrausgesetzteEinheiten);

        Werte w = new Werte();
        w.setBasisTrefferpunkte(StrToInt(Ttrefferpunkte.getText()));
        w.setBauzeit(StrToInt(Tbauzeit.getText()));
        w.setEssensKosten(StrToInt(Tessenskosten.getText()));
        w.setKollisionsGroesse(StrToInt(Tkollisionsgroesse.getText()));
        w.setOelKosten(StrToInt(Trohstoffkosten.getText()));
        w.setProduziertesEssen(StrToInt(Tproduziertesessen.getText()));
        w.setSichtradius(StrToDb(Tsichtradius.getText()));
        w.setTransportgroesse(StrToInt(Ttransportgroesse.getText()));
        w.setTrefferpunkteRegeneration(StrToDb(Tregeneration.getText()));
        w.setTrefferpunkteRegenerationstyp((Regenerationstyp) CBregenerationstyp.getSelectedItem());
        w.setVolk((Volk) CBvolk.getSelectedItem());

        einheit.addAttribut(a);
        einheit.addAttribut(b);
        einheit.addAttribut(g);
        einheit.addAttribut(k);
        einheit.addAttribut(t);
        einheit.addAttribut(tech);
        einheit.addAttribut(w);
        om.getEinheitenbank().add(einheit);

        reset(this);
        reload();
    }

    private void lade(Einheit e) {
        Audio a = (Audio) e.getAttribut(EditorAttribut.TYP_GERAUSCHE);
        CBbauloop.setSelectedItem(a.getBauloop());
        CBsoundset.setSelectedItem(a.getEinheitenSoundset());
        Bewegung b = (Bewegung) e.getAttribut(EditorAttribut.TYP_BEWEGUNG);
        Tbasistempo.setText(b.getBasistempo() + "");
        Tdrehrate.setText(b.getDrehrate() + "");
        Thoehe.setText(b.getHoehe() + "");
        TmaxTempo.setText(b.getTempo_max() + "");
        TminTempo.setText(b.getTempo_min() + "");
        CBbewegungstyp.setSelectedItem(b.getBewegungstyp());
        Grafik g = (Grafik) e.getAttribut(EditorAttribut.TYP_GRAFIK);
        Tgehtempo.setText(g.getAnimationGehTempo() + "");
        Trenntempo.setText(g.getAnimationRennTempo() + "");
        Tueberblendzeit.setText(g.getUeberblendzeit() + "");
        Tauswahlskalierung.setText(g.getAuswahlSkalierung() + "");
        Tauswahlhoehe.setText(g.getAuswahlkreisHoehe() + "");
        CBbodentextur.setSelectedItem(g.getBodentextur());
        CBmodelldatei.setSelectedItem(g.getModell());
        CBschattentextur.setSelectedItem(g.getSchattentextur());
        Tskalierung.setText(g.getSkalierung() + "");
        ChBteamfarbe.setSelected(g.isEigeneTeamfarbe());
        TgeschosseinschlagZ.setText(g.getGeschossEinschlagZ() + "");
        TgeschossstartX.setText(g.getGeschossStartX() + "");
        TgeschossstartY.setText(g.getGeschossStartY() + "");
        TgeschossstartZ.setText(g.getGeschossStartZ() + "");
        Tfahrtwinkel.setText(g.getMaxFahrtWinkel() + "");
        Tschwenkwinkel.setText(g.getMaxSchwenkWinkel() + "");
        TschattenbildHoehe.setText(g.getSchattenbildHoehe() + "");
        TschattenbildBreite.setText(g.getSchattenbildBreite() + "");
        ChBgeschossskalierung.setSelected(g.isGeschosseSkalieren());
        ChBwasserschatten.setSelected(g.isWasserschatten());
        Kampf k = (Kampf) e.getAttribut(EditorAttribut.TYP_KAMPF);
        Tabklingzeit.setText(k.getAbklingzeit() + "");
        Tbasisschaden.setText(k.getBasisSchaden() + "");
        Twuerfelseiten.setText(k.getSchadenWuerfelSeiten() + "");
        Twuerfelzahl.setText(k.getSchadenWuerfelAnzahl() + "");
        Twirkungsbereich.setText(k.getSchadenWirkungsbereich() + "");
        Tstreuradius.setText(k.getSchadenStreuradius() + "");
        Tverlustfaktor.setText(k.getSchadenVerlustfaktor() + "");
        Tgeschossbogen.setText(k.getGeschossBogen() + "");
        Tgeschosstempo.setText(k.getGeschossTempo() + "");
        Treichweite.setText(k.getReichweite() + "");
        Tmindestreichweite.setText(k.getMinreichweite() + "");
        Tbewegungspuffer.setText(k.getReichweitenBewegungsPuffer() + "");
        ChBzielsuchendesgeschoss.setSelected(k.isZielsuchendesGeschoss());
        Tzielerfassung.setText(k.getZielerfassungsReichweite() + "");
        TgleichzeitigeZiele.setText(k.getMaxAnzahlZiele() + "");
        CBangriffstyp.setSelectedItem(k.getAngriffstyp());
        CBgeschossgrafik.setSelectedItem(k.getGeschossGrafik());
        CBzielgrafik.setSelectedItem(k.getZielGrafik());
        CBwaffensound.setSelectedItem(k.getWaffensound());
        CBwaffentyp.setSelectedItem(k.getWaffentyp());
        Tzielwirkungsbereich.setText(k.getZielWirkungsbereich() + "");
        Tzugelasseneziele.setText(k.getZugelasseneZiele() + "");
        CBverteidigungstyp.setSelectedItem(k.getVerteidigungstyp());
        tbasisverteidigung.setText(k.getBasisVerteidigung() + "");
        Tzieltyp.setText(k.getZieltyp() + "");
        Technologie tech = (Technologie) e.getAttribut(EditorAttribut.TYP_TECHNOLOGIEBAUM);
        Tvorrausgesetzeeinheiten.setText(tech.getVorrausgesetzteEinheiten() + "");
        Tverkaufteeinheiten.setText(tech.getVerkaufteEinheiten() + "");
        Werte w = (Werte) e.getAttribut(EditorAttribut.TYP_WERTE);
        Tkollisionsgroesse.setText(w.getKollisionsGroesse() + "");
        Tbauzeit.setText(w.getBauzeit() + "");
        Tessenskosten.setText(w.getEssensKosten() + "");
        Trohstoffkosten.setText(w.getOelKosten() + "");
        Ttrefferpunkte.setText(w.getBasisTrefferpunkte() + "");
        Tregeneration.setText(w.getTrefferpunkteRegeneration() + "");
        Tproduziertesessen.setText(w.getProduziertesEssen() + "");
        Tsichtradius.setText(w.getSichtradius() + "");
        Ttransportgroesse.setText(w.getTransportgroesse() + "");
        CBregenerationstyp.setSelectedItem(w.getTrefferpunkteRegenerationstyp());
        CBvolk.setSelectedItem(w.getVolk());

    }

    /**
     * parse methode
     * @param s
     * @return
     */
    public int StrToInt(String s) {
        return Integer.parseInt(s);
    }

    /**
     * parse methode
     * @param s
     * @return
     */
    public double StrToDb(String s) {
        return Double.parseDouble(s);
    }

    /**
     * parse methode
     * @param s
     * @return
     */
    public double StrToFl(String s) {
        return Float.parseFloat(s);
    }
}
